import styles from './index.less'

import React, { useState, useEffect } from 'react';
import { getUserList } from '@/api/react'

const Mock: React.FC = (props) => {
  const [users,setUsers] = useState<any[]>([]);

  useEffect(()=>{
    getUsers()
  },[]);

  const getUsers = async () => {
    const res = await getUserList()
    setUsers(()=>[...res.data])
  };

  return (
    <div className='page-container'>
      <div className='scroll-container'>
        <div className={styles['step-container']}>
          <h1>这是mock的用户数据（本地运行才能看到mock数据）</h1>
          {
            users.map(item=>{
              return <p key={item.id}>{item.name}--{item.age}岁</p>
            })
          }
        </div>
      </div>
    </div>
  );
};

export default Mock;
